﻿* Encoding: UTF-8.
* code conditions

DATASET ACTIVATE DataSet1.
IF  (inequality_code = 0 & rating_code = 0) condition=1.
IF  (inequality_code = 0 & rating_code = 1) condition=2.
IF  (inequality_code = 1 & rating_code = 0) condition=3.
IF  (inequality_code = 1 & rating_code = 1) condition=4.
EXECUTE.

*Anderson-Darling test was ran in R using nortest::ad.test(your_data)

*conduct KW test

NPAR TESTS
  /K-W=lending_amount_1 BY condition(1 4)
  /MISSING ANALYSIS.


*quantile regressions
    

QUANTILE REGRESSION lending_amount_1 BY inequality_code rating_code
  /CRITERIA QUANTILE=0.5 METHOD=AUTO IID=TRUE BANDWIDTH=BOFINGER TOL=0.000000000001 CONV=0.000001 
    MAXITER=2000 CILEVEL=95
  /MISSING CLASSMISSING=EXCLUDE
  /MODEL inequality_code rating_code inequality_code*rating_code INTERCEPT=TRUE
  /PRINT PARAMETER 
  /PLOT PARAM_EST=50 PREDICTED_BY_OBSERVED=FALSE MAX_CATEGORIES=10
  /PREDICT_EFFECTS NUM_TOP_EFFECTS=3.

USE ALL.
COMPUTE filter_$=(rating_code = 0).
VARIABLE LABELS filter_$ 'rating_code = 0 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

QUANTILE REGRESSION lending_amount_1 BY inequality_code
  /CRITERIA QUANTILE=0.5 METHOD=AUTO IID=TRUE BANDWIDTH=BOFINGER TOL=0.000000000001 CONV=0.000001 
    MAXITER=2000 CILEVEL=95
  /MISSING CLASSMISSING=EXCLUDE
  /MODEL inequality_code INTERCEPT=TRUE
  /PRINT PARAMETER 
  /PLOT PARAM_EST=50 PREDICTED_BY_OBSERVED=FALSE MAX_CATEGORIES=10
  /PREDICT_EFFECTS NUM_TOP_EFFECTS=3.

USE ALL.
COMPUTE filter_$=(rating_code = 1).
VARIABLE LABELS filter_$ 'rating_code = 1 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.


QUANTILE REGRESSION lending_amount_1 BY inequality_code
  /CRITERIA QUANTILE=0.5 METHOD=AUTO IID=TRUE BANDWIDTH=BOFINGER TOL=0.000000000001 CONV=0.000001 
    MAXITER=2000 CILEVEL=95
  /MISSING CLASSMISSING=EXCLUDE
  /MODEL inequality_code INTERCEPT=TRUE
  /PRINT PARAMETER 
  /PLOT PARAM_EST=50 PREDICTED_BY_OBSERVED=FALSE MAX_CATEGORIES=10
  /PREDICT_EFFECTS NUM_TOP_EFFECTS=3.
